Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test the simulation mode code. #5712

Merged
merged 7 commits into from
Oct 26, 2023
Merged

Conversation

wxtim
Copy link
Member

@wxtim wxtim commented Aug 30, 2023

Closes #5654

Pre-requisite work for Skip mode

  • Refactor simulation mode functions.
  • Improve documentation of sim mode settings.
  • Ensure 100% test coverage of sim mode.

On an initial self-review I noticed that configure_sim_modes might as well be in the simulation module. I've moved it, but not squashed that commit down, because that way reviewers can see how I refactored it in a separate commit to the one I move it in.

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • CHANGES.md entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at Updated sim mode docs cylc-doc#641.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@wxtim wxtim requested review from hjoliver and oliver-sanders and removed request for hjoliver August 30, 2023 09:24
@wxtim wxtim self-assigned this Aug 30, 2023
@wxtim wxtim added this to the cylc-8.3.0 milestone Aug 30, 2023
@wxtim wxtim added doc Documentation could be better Not exactly a bug, but not ideal. labels Aug 30, 2023
@wxtim wxtim force-pushed the test.sim_mode branch 3 times, most recently from ce9c70c to d5ec93a Compare August 30, 2023 09:44
@wxtim wxtim marked this pull request as draft August 30, 2023 11:57
@wxtim
Copy link
Member Author

wxtim commented Aug 30, 2023

Changed to draft because a final sanity check/attempt to write an example for the docs showed up at least 2 exciting bugs.

For the record these bugs are as follows:

Traceback when trying to resubmit simulated task:

Using example:

[scheduling]
    initial cycle point = 2359
    [[graph]]
        R1 = get_observations

[runtime]
    [[get_observations]]
        execution retry delays = PT2S
        [[[simulation]]]
            fail cycle points = all

fails with traceback after the method _simulation_submit_task_jobs sets platform = {'name': 'SIMULATION'}, thereby deleting all other settings!

Resubmit task hangs in waiting state:

Using the same example but fixing the first bug. Resubmit hangs forever because the _simulation_submit_task_jobs keep gives the simulated second submission a status of waiting before calling process_message, which then fails to do anything because the task is in a waiting state.

@wxtim wxtim marked this pull request as ready for review August 31, 2023 12:31
@wxtim wxtim mentioned this pull request Aug 31, 2023
1 task
@wxtim wxtim requested a review from oliver-sanders August 31, 2023 15:32
Copy link
Member

@oliver-sanders oliver-sanders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach looks good, I like having all the simulation stuff in once place!

Some minor comments.

cylc/flow/task_job_mgr.py Outdated Show resolved Hide resolved
cylc/flow/task_job_mgr.py Show resolved Hide resolved
cylc/flow/task_job_mgr.py Outdated Show resolved Hide resolved
tests/functional/modes/03-simulation.t Outdated Show resolved Hide resolved
tests/integration/test_simulation.py Outdated Show resolved Hide resolved
tests/integration/test_simulation.py Outdated Show resolved Hide resolved
tests/integration/test_simulation.py Outdated Show resolved Hide resolved
@wxtim wxtim mentioned this pull request Sep 6, 2023
8 tasks
@wxtim wxtim requested a review from oliver-sanders September 6, 2023 15:28
itask.summary['started_time'] = now
timeout = (
itask.summary['started_time'] +
itask.tdef.rtconfig['simulation']['simulated run length']
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a real config item, added to the rtconfig['simulation'] dictionary at line 54.

cylc/flow/task_events_mgr.py Outdated Show resolved Hide resolved
itask.state(TASK_STATUS_WAITING)
and
itask.state(TASK_STATUS_WAITING)
and itask.tdef.run_mode == 'live' # Polling in live mode only.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code within this section is designed to avoid problems with polling - but there will be no polling in simulation mode.

@wxtim wxtim marked this pull request as draft October 5, 2023 07:59
@wxtim wxtim marked this pull request as ready for review October 9, 2023 14:50
@wxtim wxtim marked this pull request as draft October 9, 2023 14:50
wxtim and others added 5 commits October 18, 2023 08:42
Co-authored-by: Oliver Sanders <oliver.sanders@metoffice.gov.uk>
* Remove unecessary rtc['platform'] (@MetRonnie spotted this).
* 'test.sim_mode' of github.com:wxtim/cylc:
  Update tests/functional/modes/03-simulation.t
* upstream/master:
  speed up import time (cylc#5770)
  graphql: remove extraLogs field (cylc#5672)
  give a more useful error message if remote init fails (cylc#5720)
  clarify SLURM job handler docs (cylc#5748)
@wxtim wxtim marked this pull request as draft October 18, 2023 10:02
@wxtim wxtim marked this pull request as ready for review October 18, 2023 10:17
@wxtim wxtim requested a review from MetRonnie October 18, 2023 10:18
tests/unit/test_config.py Outdated Show resolved Hide resolved
tests/unit/test_simulation.py Outdated Show resolved Hide resolved
tests/unit/test_simulation.py Outdated Show resolved Hide resolved
cylc/flow/simulation.py Outdated Show resolved Hide resolved
tests/unit/test_simulation.py Outdated Show resolved Hide resolved
@wxtim
Copy link
Member Author

wxtim commented Oct 18, 2023

@oliver-sanders - accidentally re-tagged you for review. Happy for you to re-approve

@MetRonnie MetRonnie removed the doc Documentation label Oct 18, 2023
@MetRonnie
Copy link
Member

MetRonnie commented Oct 19, 2023

While you're here Tim, could you check that restarting a workflow that has been running in simulation mode will restart it in simulation mode without having to specify it? I saw it restart in live mode, would be good to double check.

Also the reverse. Oliver said trying to restart in simulation mode when it had been running in live mode merely restarted in live mode.

@wxtim
Copy link
Member Author

wxtim commented Oct 20, 2023

check that restarting a workflow that has been running in simulation mode will restart it in simulation mode without having to specify it?

Yes, if you restart you do not have to specify mode to get the same mode.

Oliver said trying to restart in simulation mode when it had been running in live mode merely restarted in live mode.

When I tried this on master it looks like it restarts in simulation mode (on master & my branch). Ick.

That's a bug: I've opened an issue at #5781

@wxtim wxtim force-pushed the test.sim_mode branch 2 times, most recently from 409742f to 5241558 Compare October 24, 2023 08:34
@hjoliver
Copy link
Member

This has two approvals, but I'm not sure if all questions addressed yet? If so, let's merge it.

@wxtim
Copy link
Member Author

wxtim commented Oct 25, 2023

This has two approvals, but I'm not sure if all questions addressed yet? If so, let's merge it.

I think that I have addressed all questions. There is a comment from Ronnie about restart where the response was to create a new issue - the bit about what mode a restarted workflow uses.

Agreed, but I think @MetRonnie or @oliver-sanders should press the button here.

Copy link
Member

@MetRonnie MetRonnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending resolution of Oliver's comment #5712 (comment)

@oliver-sanders oliver-sanders merged commit 8606f93 into cylc:master Oct 26, 2023
23 of 25 checks passed
@wxtim wxtim deleted the test.sim_mode branch October 26, 2023 09:39
wxtim added a commit to wxtim/cylc that referenced this pull request Jan 16, 2024
@wxtim wxtim mentioned this pull request Jan 17, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
could be better Not exactly a bug, but not ideal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test Simulation Mode
4 participants